package org.lyfeng.spring.beans;

import org.lyfeng.spring.beans.definitions.BeanDefinition;
import org.lyfeng.spring.exception.BeansExceptions;

/**
 * spring ioc容器核心
 * @author leiyufeng
 * 2013-4-22 下午2:14:28
 */
public interface BeanFactory {
	/**
	 * 通过name获取bean
	 * @param name
	 * @return
	 * @throws BeansExceptions
	 */
	Object getBean(String name) throws BeansExceptions;
	/**
	 * 通过class对象获取bean
	 * @param requiredType
	 * @return
	 * @throws BeansExceptions
	 */
	<T> T getBean(Class<T> requiredType) throws BeansExceptions;
	/**
	 * 是否包含bean
	 * @param name
	 * @return
	 */
	boolean containsBean(String name);
	/**
	 * spring容器入口
	 * @return
	 */
	boolean refresh();
	
	/**
	 * 通过beanClass创建bean instance
	 * @param beanClass
	 * @return 新创建的bean实例
	 * @throws BeansExceptions
	 */
	<T> T createBean(BeanDefinition BeanDefinition) throws BeansExceptions;
}
